package com.mt.mall.entity.good;

import javax.persistence.*;
import java.io.Serializable;
import com.mt.common.core.annotation.DColumn;
import com.mt.common.core.annotation.DEntity;
import com.mt.common.core.web.base.BaseEntity;
import com.mt.mall.entity.Order.Order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;



import java.util.Date;
import com.mt.common.system.entity.User;
import com.mt.common.system.entity.Attachment;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.List;

@DEntity(label="商品评价",comment="",moduleLabel="评价")
@Entity(name="mall_evaluation")
@Table(name = "mall_evaluation" , indexes = { @Index(name = "index_user_id", columnList = "user_id"),@Index(name = "index_evaluations_id", columnList = "evaluations_id"),@Index(name = "index_commodity_id", columnList = "commodity_id"),@Index(name = "index_order_id", columnList = "order_id")  })
@ApiModel(description = "商品评价:")
public class Evaluation extends BaseEntity implements Serializable{
	private static final long serialVersionUID = 1L;

	@DColumn(index=3,label="评分",comment="评分",component="数字",where=true)
	@ApiModelProperty(value = "评分:评分")
	@Column(name="score",length=255,nullable=false,unique=false)
	private Integer score;

	@DColumn(index=4,label="评价内容",comment="评价内容",component="文本",where=true)
	@ApiModelProperty(value = "评价内容:评价内容")
	@Column(name="content",length=255,nullable=true,unique=false)
	private String content;

	@DColumn(index=5,label="评价时间",comment="评价时间",component="日期选择",where=true)
	@ApiModelProperty(value = "评价时间:评价时间")
	@Column(name="date",length=255,nullable=true,unique=false)
	@JsonSerialize(using = DateSerializer.class)
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date date;

	@DColumn(index=6,label="用户",foreignEntity="User",comment="",component="文本",where=true)
	@ApiModelProperty(value = "用户:")
	@Column(name="user_id",length=255,nullable=true,unique=false)
	private Long userId;

	@Transient
	private User user;

	@Transient
	private String userAvatar;

	@Transient
	@ApiModelProperty(value = "用户名称:")
	@DColumn(index=6,label="用户",foreignEntity="User",comment="")
	private String userName;

	@DColumn(index=7,label="追评",foreignEntity="Evaluation",comment="追评",component="对象选择",where=false)
	@ApiModelProperty(value = "追评:追评")
	@Column(name="evaluations_id",length=255,nullable=true,unique=false)
	private Long evaluationsId;

	@Transient
	private Evaluation evaluations;

	@Transient
	@ApiModelProperty(value = "追评名称:追评")
	@DColumn(index=7,label="追评",foreignEntity="Evaluation",comment="追评")
	private String evaluationsName;

	@Transient
	private List<Attachment> attachments;

	@DColumn(index=9,label="商品",foreignEntity="Commodity",comment="商品",component="对象选择",where=true)
	@ApiModelProperty(value = "商品:商品")
	@Column(name="commodity_id",length=255,nullable=true,unique=false)
	private Long commodityId;

	@Transient
	private Commodity commodity;

	@Transient
	@ApiModelProperty(value = "商品名称:商品")
	@DColumn(index=9,label="商品",foreignEntity="Commodity",comment="商品")
	private String commodityName;

	@Transient
	private String description;

	@DColumn(index=10,label="订单",foreignEntity="Order",comment="订单",component="对象选择",where=true)
	@ApiModelProperty(value = "订单:订单")
	@Column(name="order_id",length=255,nullable=true,unique=false)
	private Long orderId;

	@Transient
	private Order order;

	@Transient
	@ApiModelProperty(value = "订单名称:订单")
	@DColumn(index=10,label="订单",foreignEntity="Order",comment="订单")
	private String orderName;

	@Transient
	private String orderCode;

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

	public Integer getScore() {
		return this.score;
	}

	public void setScore(Integer score) {
		this.score = score;
	}

	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public Date getDate() {
		return this.date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public Long getUserId() {
		return this.userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getEvaluationsId() {
		return this.evaluationsId;
	}

	public void setEvaluationsId(Long evaluationsId) {
		this.evaluationsId = evaluationsId;
	}

	public List<Attachment> getAttachments() {
		return this.attachments;
	}

	public void setAttachments(List<Attachment> attachments) {
		this.attachments = attachments;
	}

	public Long getCommodityId() {
		return this.commodityId;
	}

	public void setCommodityId(Long commodityId) {
		this.commodityId = commodityId;
	}

	public Long getOrderId() {
		return this.orderId;
	}

	public void setOrderId(Long orderId) {
		this.orderId = orderId;
	}

	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		if(user == null){
		}
		else
		{
		this.userId = user.getEid();
		this.user = user;		
		}
}

	public String getUserName() {
		return this.userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Evaluation getEvaluations() {
		return this.evaluations;
	}

	public void setEvaluations(Evaluation evaluations) {
		if(evaluations == null){
		}
		else
		{
		this.evaluationsId = evaluations.getEid();
		this.evaluations = evaluations;		
		}
}

	public String getEvaluationsName() {
		return this.evaluationsName;
	}

	public void setEvaluationsName(String evaluationsName) {
		this.evaluationsName = evaluationsName;
	}

	public Commodity getCommodity() {
		return this.commodity;
	}

	public void setCommodity(Commodity commodity) {
		if(commodity == null){
		}
		else
		{
		this.commodityId = commodity.getEid();
		this.commodity = commodity;		
		}
}

	public String getCommodityName() {
		return this.commodityName;
	}

	public void setCommodityName(String commodityName) {
		this.commodityName = commodityName;
	}

	public Order getOrder() {
		return this.order;
	}

	public void setOrder(Order order) {
		if(order == null){
		}
		else
		{
		this.orderId = order.getEid();
		this.order = order;		
		}
}

	public String getOrderName() {
		return this.orderName;
	}

	public void setOrderName(String orderName) {
		this.orderName = orderName;
	}

	public String getUserAvatar() {
		return userAvatar;
	}

	public void setUserAvatar(String userAvatar) {
		this.userAvatar = userAvatar;
	}
}
